using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class AssetsManager_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase method;
            FieldInfo field;
            Type[] args;
            Type type = typeof(global::AssetsManager);
            args = new Type[]{};
            method = type.GetMethod("Start", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Start_0);
            args = new Type[]{};
            method = type.GetMethod("Update", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Update_1);
            args = new Type[]{};
            method = type.GetMethod("DownloadRemainAssets", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, DownloadRemainAssets_2);

            field = type.GetField("Parts", flag);
            app.RegisterCLRFieldGetter(field, get_Parts_0);
            app.RegisterCLRFieldSetter(field, set_Parts_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_Parts_0, AssignFromStack_Parts_0);


            app.RegisterCLRCreateDefaultInstance(type, () => new global::AssetsManager());
            app.RegisterCLRCreateArrayInstance(type, s => new global::AssetsManager[s]);

            args = new Type[]{};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);

        }


        static StackObject* Start_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);


            global::AssetsManager.Start();

            return __ret;
        }

        static StackObject* Update_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);


            global::AssetsManager.Update();

            return __ret;
        }

        static StackObject* DownloadRemainAssets_2(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);


            global::AssetsManager.DownloadRemainAssets();

            return __ret;
        }


        static object get_Parts_0(ref object o)
        {
            return global::AssetsManager.Parts;
        }

        static StackObject* CopyToStack_Parts_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = global::AssetsManager.Parts;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_Parts_0(ref object o, object v)
        {
            global::AssetsManager.Parts = (global::AssetsChecker.AssetsPart[])v;
        }

        static StackObject* AssignFromStack_Parts_0(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            global::AssetsChecker.AssetsPart[] @Parts = (global::AssetsChecker.AssetsPart[])typeof(global::AssetsChecker.AssetsPart[]).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            global::AssetsManager.Parts = @Parts;
            return ptr_of_this_method;
        }



        static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);

            var result_of_this_method = new global::AssetsManager();

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }


    }
}
